<template>
    <div class="left">
      <div class="logo hcenter">
        <img src="../../../public/1.png" alt="" class="logo-img">
        <span>Manager</span>
      </div>
      <el-menu
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      background-color="#001529"
      text-color="#fff"
      unique-opened
      router
      style="border-right:none;"
      active-text-color="#ffd04b">
        <tree-menu :menuList="menuList"></tree-menu>
    </el-menu>
    </div>
</template>

<script>
import userModel from '../../api/user.js';
import TreeMenu from '../common/TreeMenu.vue';

export default {
  data() {
    return {
    };
  },
  computed: {
    menuList() {
      return this.$store.state.menuList || [];
    },
  },
  created() {
    this.initlist();
  },
  methods: {
    async initlist() {
      const { menuList, actionList } = await userModel.getUserInfo();
      this.$store.commit('saveMenuList', menuList);
      this.$store.commit('saveactionList', actionList);
    },
  },
  components: {
    TreeMenu,
  },
};
</script>

<style>

</style>
